<?php 
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;


$a=12334324324;

//Load composer's autoloader
require 'vendor/autoload.php';
require 'emailHtml.php';
$css = require_once('./css.php');
$post = $_POST;

$fromName = 'test';

if($post['client']=='pc'){
	$html = $css.pcBody($post['result']).$post['html'];
}else{
	$html = $css.mBody($post).$post['html'];
}


//return;
// pcBody($post['result']);

//$post['html'] = $css.pcBody($post['result']).$post['html'];

$sendResult = sendEmail($post['email'],$fromName,$html);


return $sendResult;



function sendEmail($toUser,$subject,$body){
	$mail = new PHPMailer(true);                              // Passing `true` enables exceptions
	try {
	    //Server settings
	    $mail->SMTPDebug = 0;                                 // Enable verbose debug output
	    $mail->isSMTP();                                      // Set mailer to use SMTP
	    $mail->Host = 'smtp.qq.com';  // Specify main and backup SMTP servers
	    $mail->SMTPAuth = true;                               // Enable SMTP authentication
	    $mail->Username = '240088298@qq.com';                 // SMTP username
	    $mail->Password = 'odldakumtedycbbh';                           // SMTP password
	    $mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
	    $mail->Port = 465;                                    // TCP port to connect to
	    $mail->CharSet = 'UTF-8';

	    $fromName = 'auひかり★お知らせニュース ';

	    //Recipients
	    $mail->setFrom('240088298@qq.com', $fromName);
	    //$mail->addAddress('153400432@qq.com', 'Joe User');     // Add a recipient
	    $mail->addAddress($toUser);               // Name is optional
	    //$mail->addReplyTo('240088298@qq.com', 'Information');
	    //$mail->addCC('cc@example.com');
	    //$mail->addBCC('bcc@example.com');

	    //Attachments
	    //$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
	    //$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name

	    //Content
	    $mail->isHTML(true);                                  // Set email format to HTML
	    $mail->Subject = $subject;
	    $mail->Body    = $body;
	    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

	    $mail->send();
	    //echo 'Message has been sent';
	    return true;
	} catch (Exception $e) {
	    return false;
	    echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
	}
}

